treeview: don't use wide-separators/separator-height
authorCosimo Cecchi <cosimoc@gnome.org>
Wed, 30 Dec 2015 18:36:28 +0000 (10:36 -0800)
committerCosimo Cecchi <cosimoc@gnome.org>
Sun, 3 Jan 2016 08:42:51 +0000 (00:42 -0800)
Those style properties are on their way out; instead, use min-height
with the separator style class to obtain the height.

gtk/gtktreeview.c
gtk/theme/Adwaita/_common.scss
gtk/theme/Adwaita/gtk-contained-dark.css
gtk/theme/Adwaita/gtk-contained.css

index 52fd9d2820031cceefd4d8ad290efeb5f4f3e490..884e2ddc75fd68efc294acf2badb5a8f5e346638 100644 (file)
@@ -24,6 +24,7 @@
 #include "gtktreeview.h"
 
 #include "gtkadjustmentprivate.h"
+#include "gtkcssnumbervalueprivate.h"
 #include "gtkrbtree.h"
 #include "gtktreednd.h"
 #include "gtktreeprivate.h"
@@ -6239,6 +6240,32 @@ node_is_visible (GtkTreeView *tree_view,
   return FALSE;
 }
 
+static gint
+get_separator_height (GtkTreeView *tree_view)
+{
+  GtkStyleContext *context;
+  GtkCssStyle *style;
+  gdouble d;
+  gint min_size;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (tree_view));
+  gtk_style_context_save (context);
+  gtk_style_context_add_class (context, GTK_STYLE_CLASS_SEPARATOR);
+
+  style = gtk_style_context_lookup_style (context);
+  d = _gtk_css_number_value_get
+    (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_MIN_HEIGHT), 100);
+
+  if (d < 1)
+    min_size = ceil (d);
+  else
+    min_size = floor (d);
+
+  gtk_style_context_restore (context);
+
+  return min_size;
+}
+
 /* Returns TRUE if it updated the size
  */
 static gboolean
@@ -6259,8 +6286,6 @@ validate_row (GtkTreeView *tree_view,
   gboolean is_separator = FALSE;
   gboolean draw_vgrid_lines, draw_hgrid_lines;
   gint grid_line_width;
-  gboolean wide_separators;
-  gint separator_height;
   gint expander_size;
 
   /* double check the row needs validating */
@@ -6274,8 +6299,6 @@ validate_row (GtkTreeView *tree_view,
                        "horizontal-separator", &horizontal_separator,
                        "vertical-separator", &vertical_separator,
                        "grid-line-width", &grid_line_width,
-                        "wide-separators",  &wide_separators,
-                        "separator-height", &separator_height,
                        NULL);
   
   draw_vgrid_lines =
@@ -6328,12 +6351,9 @@ validate_row (GtkTreeView *tree_view,
                                          NULL, &row_height);
 
       if (is_separator)
-       {
-          if (wide_separators)
-            height = separator_height;
-          else
-            height = 2;
-       }
+        {
+          height = get_separator_height (tree_view);
+        }
       else
         {
           row_height += vertical_separator;
index 3dd623c101643e549a8a79a1bbc2e5a1bcacf105..951d19aeb9e263b4012d3162659bc04b5ffad4a9 100644 (file)
@@ -1352,8 +1352,11 @@ treeview.view {
     &:backdrop { color: $backdrop_insensitive_color; }
   }
 
-  &.separator:backdrop {
-    color: transparentize(black, 0.9);
+  &.separator {
+    min-height: 2px;
+    &:backdrop {
+      color: transparentize(black, 0.9);
+    }
   }
 
   &:backdrop {
index 0d6a13014c2cb6a4ff819694dbead06b1fbed338..70b7b4f6c86d0174db62b62d2549937a9eef1772 100644 (file)
@@ -1998,8 +1998,10 @@ treeview.view {
         color: #648eba; }
     treeview.view:disabled:backdrop {
       color: #5d6767; }
-  treeview.view.separator:backdrop {
-    color: rgba(0, 0, 0, 0.1); }
+  treeview.view.separator {
+    min-height: 2px; }
+    treeview.view.separator:backdrop {
+      color: rgba(0, 0, 0, 0.1); }
   treeview.view:backdrop {
     border-left-color: #676b6b;
     border-top: #393f3f; }
index c217e6509d70534348622815dc02d9381b13d96a..50703a064c0f3fccdd828702610e019ce36bd628 100644 (file)
@@ -1998,8 +1998,10 @@ treeview.view {
         color: #80b1e4; }
     treeview.view:disabled:backdrop {
       color: #c3c3c0; }
-  treeview.view.separator:backdrop {
-    color: rgba(0, 0, 0, 0.1); }
+  treeview.view.separator {
+    min-height: 2px; }
+    treeview.view.separator:backdrop {
+      color: rgba(0, 0, 0, 0.1); }
   treeview.view:backdrop {
     border-left-color: #babbbb;
     border-top: #e8e8e7; }